package com.example.check_in.feign;

import com.example.core.config.FeignConfig;
import com.example.check_in.feign.fallback.PaymentFeignClientFallback;

import com.example.model.payment.Payment;
import com.example.model.response.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@FeignClient(value = "service-payment", fallback = PaymentFeignClientFallback.class, configuration = FeignConfig.class)
public interface PaymentFeignClient {


    @PostMapping("/payment/pay")
    Result makePayment(@RequestBody Payment payment,
                       @RequestParam("amount") BigDecimal amount,
                       @RequestParam("pay") BigDecimal pay);

    @GetMapping("/payment/{paymentId}")
    public Result get(@PathVariable("paymentId") String paymentId);

    @PostMapping("/payment/refund")
    public Result refund(@RequestParam("paymentId") Long paymentId, @RequestParam("amount") BigDecimal amount);

}
